//
//  UpStairCell.m
//  CarFace
//
//  Created by dlios on 15/3/24.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "UpStairCell.h"

@implementation UpStairCell

- (void)dealloc
{
    [_view release];
    [_label release];
    [super dealloc];
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.label = [[UILabel alloc] init];
//        self.label.backgroundColor = [UIColor greenColor];
        self.label.font = [UIFont systemFontOfSize:15];
        self.label.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.label];
//        self.label.userInteractionEnabled = YES;
        [_label release];
        
        self.view = [[UIView alloc] init];
        [self.label addSubview:self.view];
//        self.view.backgroundColor = [UIColor orangeColor];
        [_view release];
 
        //button不好用
//        self.button = [UIButton buttonWithType:UIButtonTypeSystem];
//        [self.contentView addSubview:self.button];
//        [self.button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchDown];
        
        
//        手势也不好用
//        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
//        [self.label addGestureRecognizer:tap];
//        [tap release];
        
        
    }
    return self;
}

- (void)setChangeCS:(BOOL)changeCS
{
    _changeCS = changeCS;
    self.view.backgroundColor = changeCS ? [UIColor orangeColor] : [UIColor clearColor];
    self.label.font = changeCS ? [UIFont systemFontOfSize:17] :[UIFont systemFontOfSize:15];
    
}

// 改变大小
- (void)setChangeLar:(BOOL)changeLar
{
    _changeLar = changeLar;
    self.label.font = changeLar ? [UIFont systemFontOfSize:17] :[UIFont systemFontOfSize:15];
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    self.label.frame = layoutAttributes.bounds;
    self.view.frame = CGRectMake(0, layoutAttributes.frame.size.height * 9 / 10, layoutAttributes.frame.size.width, layoutAttributes.frame.size.height * 1 / 10);
//    self.button.frame = layoutAttributes.bounds;
}
- (void)buttonAction:(UIButton *)button
{
//    NSLog(@"%@", self.button.titleLabel.text);
}
//- (void)tapAction:(UITapGestureRecognizer *)tap
//{
//    self.label.textColor = [UIColor redColor];
//}
@end
